<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
${aier_doctype}
<html <s:property value="aier_html_xmlns" escape="false"/>>
<head>
<meta http-equiv="Content-Type" content="${aier_content_type}" />
<meta name="keywords" content="${aier_keyworks}" />
<meta name="description" content="${aier_description}" />
<link rel="stylesheet" href="${aier_css_url}${aier_jqui_css}ui.css" />
<link rel="Stylesheet" href="${aier_css_url}jq/jq.css" />
<link rel="stylesheet" href="${aier_css_url}${aier_jqui_css}text.css" />
<link rel="stylesheet" href="${aier_css_url}${aier_jqui_css}enhanced.css" />
<link rel="stylesheet" href="${aier_css_url}proxy/apc.css" />

<script type="text/javascript" src="${aier_js_url}j.js"></script>
<script type="text/javascript" src="${aier_js_url}b.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/hh/ui.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/msg.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/hh/dialog.js"></script>
<script type="text/javascript" src="${aier_js_url}97/WdatePicker.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/cn.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/jq.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/block.js"></script>
<script type="text/javascript" src="${aier_js_url}${aier_jqui_js}custominput.js"></script>
<script type="text/javascript" src="${aier_js_url}${aier_jqui_js}text.js"></script>
<title>查询IC卡</title>
<script type="text/javascript">
	$(document).ready(function() {
			$("#proCardinfo").jqGrid(
			{
				url : '${aier_url}${aier_urijs}searchprocard_search${aier_suffix}?pid=${pid}',
				datatype : "json",
				mtype : 'GET',
				height:230, 
				colNames : [ 'IC卡编号', '派属', '使用类型','分派时间 ','到期时间','卡状态' ],
				colModel : [ {name : 'cardnum',index : 'cardnum',width : 100,align:'center'}, 
							 {name : 'stateName',index : 'stateName',width : 100,sortable : false,align:'center'},
							 {name : 'usetype',index : 'usetype',width : 100,sortable : false,align:'center'}, 
							 {name : 'time_str',index : 'time_str',width : 150,sortable : false,align:'center'}, 
							 {name : 'icedate_str',index:'icedate_str',width:150,sortable:false,align:'center'},
							 {name : 'cardstate',index : 'cardstate',width : 150,sortable : false,align:'center'} 
						   ],
				//autowidth:true,
				jsonReader : {
					root : "icCards",
					page : "page",
					total : "page_count",
					records : "count",
					repeatitems : false
				},
				pager : jQuery("#proCardpage"),
				prmNames : {
					page : "page",
					sort : "sort"
				},
				rowNum : 10,
				//rowList: [10, 20, 30],
				sortname : 'cardnum',
				hidegrid : false,
				sortorder : 'asc',
				viewrecords : true,
				caption : 'IC卡信息'
			}).navGrid("#proCardpage", {edit : false,add : false,del : false,search : false});
		});
</script>
</head>
<body>
	<div id="tabs">
		<ul>
			<li><a href="#tabs-1">查询IC卡</a>
			</li>
		</ul>
		<div id="tabs-1" style="height: 500px;">
			<div class="d_content">
				<div>
					<div class="d_scnOut">
						<div class="d_scname">
							<label>区域:</label>
						</div>
						<div class="sel_position">
							<select id="area_types" onchange="changearea()">
								<option value="-1">全部</option>
								<c:forEach var="procity" items="${proCityList }">
									<option value="${procity.cid}">${procity.cname}</option>
								</c:forEach>
							</select>
						</div>
					</div>

					<div class="d_scnOut">
						<div class="d_scname">
							<label>派属:</label>
						</div>
						<div class="sel_position">
							<select id="icstate_types">
								<option value="-1">全部</option>
								<option value="10">未分派</option>
								<option value="60">已分派</option>
							</select>
						</div>
					</div>
				</div>
				<div style="margin-top: -80px;margin-left: 225px;">
					<div class="d_scnOut">
						<div class="d_scname">
							<label for="end_txt">学校:</label>
						</div>
						<div class="sel_position" id="sel_position_school">
							<select id="school_types">
								<option value="-1">全部</option>
								<c:forEach var="school" items="${schoolList }">
									<option value="${school.sid}">${school.name}</option>
								</c:forEach>
							</select>
						</div>
					</div>
					<div class="d_scnOut">
						<div class="d_scname">
							<label>批次:</label>
						</div>
						<div class="sel_position">
							<select id="head_types">
								<option value="-1">请选择</option>
								<c:forEach var="head" items="${head_searchList }">
									<option value="${head.ichead}">${head.ichead}</option>
								</c:forEach>
							</select>
						</div>
					</div>
					<div class="d_scnOut"></div>
				</div>
				<div style="margin-top: -120px;margin-left: 460px;">
					<div class="d_scname">
						<label>卡状态:</label>
					</div>
					<div class="sel_position">
						<select id="card_state_types">
							<option value="-1">全部</option>
							<option value="10">未激活</option>
							<option value="90">已激活</option>
						</select>
					</div>
					<div style="margin-top: 15px;margin-left: 65px;">
						<button id="b_pmupadd" onclick="search()"
							class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
							role="button" aria-disabled="false">
							<span class="ui-button-text">查询</span>
						</button>
					</div>
				</div>
				<div style="margin-top: 30px;margin-left: 50px;">
					<table id="proCardinfo"></table>
					<div id="proCardpage"></div>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
	$("#tabs").tabs();
	//更换区域
	function changearea() {
		var pid = "${pid}";
		var area_id = $('#area_types  option:selected').val();
		var fun = function(data) {
			var t = "<select id='school_types'><option value='-1'>请选择</option>";
			if (data.schoolList != null && data.schoolList.length > 0) {
				for ( var i = 0; i < data.schoolList.length; i++) {
					var school = data.schoolList[i];
					t += "<option value="+school.sid+">" + school.name
							+ "</option>";
				}
			}
			;
			t += "</select>";
			$('#sel_position_school').html(t);
		};
		exeAjax(
				ajaxUrl("${aier_url}${aier_urijs}searchprocard_changearea${aier_suffix}"),
				fun, {
					"pid" : pid,
					"area_id" : area_id
				});
	}
	//更换卡前缀
	function changehead() {
		var pid = "${pid}";
		var ic_head_add = $('#headadd_types  option:selected').val();
		var fun = function(data) {
			$('#txt_head_number').val(data.head_number);
		};
		exeAjax(
				ajaxUrl("${aier_url}${aier_urijs}searchprocard_changehead${aier_suffix}"),
				fun, {
					"pid" : pid,
					"ic_head_add" : ic_head_add
				});
	}
	//查询
	function search() {
		var pid = "${pid}";
		var area_id = $('#area_types  option:selected').val();//区域
		var school_id = $('#school_types  option:selected').val();//学校
		var ic_state = $('#icstate_types  option:selected').val();//派属
		var ic_head = $('#head_types  option:selected').val();//批次
		var card_state = $('#card_state_types  option:selected').val();//卡状态
		jQuery("#proCardinfo")
				.jqGrid(
						'setGridParam',
						{
							url : "${aier_url}${aier_urijs}searchprocard_search${aier_suffix}?pid="
									+ pid
									+ "&area_id="
									+ area_id
									+ "&school_id="
									+ school_id
									+ "&ic_state="
									+ ic_state
									+ "&ic_head="
									+ ic_head
									+ "&card_state=" + card_state,
							page : 1
						}).trigger("reloadGrid");
	}
</script>
</html>